home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / Moscow ML 1.42 / src / toolssrc / Deppars.grm < prev    next >
Encoding:
Text File  |  1997-08-18  |  746 b   |  51 lines  |  [TEXT/R*ch]

  1. %{
  2. open List
  3.  
  4. fun print s = BasicIO.print;
  5. fun printb s = print (s ^ " ");
  6. %}
  7.  
  8. %token ID EQUALS NULL OPEN QUAL_ID STAR 
  9. %token <string> ID QUAL_ID
  10. %token EOF
  11. %start MLtext
  12. %type <string list> MLtext MLfrag MLseq UnitName_seq LongIdent
  13. %type <string> UnitName Ident
  14.  
  15. %%
  16. MLtext :
  17.     MLseq EOF        { $1 }
  18.   | EOF            { [] }
  19. ;
  20.  
  21. MLfrag :
  22.     NULL        { [] }    
  23.   | LongIdent        { $1 }
  24.   | OPEN UnitName_seq      { $2 }
  25. ;
  26.  
  27. MLseq :
  28.     MLfrag MLseq    { $1 @ $2 }
  29.   | MLfrag              { $1 }
  30. ;
  31.  
  32. UnitName_seq :
  33.     UnitName UnitName_seq    { $1 :: $2 }
  34.   | /* empty */            { [] }
  35. ;
  36.  
  37. UnitName :
  38.     Ident           { $1 }
  39.   | EQUALS          { "=" }
  40. ;
  41.  
  42. Ident :
  43.     ID              { $1 }
  44.   | STAR            { "*" }
  45. ;
  46.  
  47. LongIdent :
  48.     Ident           { [] }
  49.   | QUAL_ID         { [$1] }
  50. ;
  51.